package com.bysj.agent.tools;

import com.bysj.agent.feign.UserFeignService;
import com.bysj.agent.service.UserService;
import com.bysj.agent.utils.R;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import entity.AiProductInfoDetailVo;
import entity.ProductInfoDetailVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserTools {

    @Autowired
    private UserFeignService userFeignService;

    @Autowired
    private UserService userService;
    //name工具名称，value工具描述
    //@P参数名称定义，value参数描述，required参数是否必填

//    @Tool(name = "获取所有用户信息",value = "获取所有用户信息")
//    public R getUsers(){
//        System.out.println("\n\n\n\n\n");
//        System.out.println(userFeignService.getUsers().toString());
//        return userFeignService.getUsers();
//    }
    @Tool(name = "收藏当前商品",value = "这是一个post请求,帮助用户收藏当前商品，但请注意，该功能需要调用用户服务，请在帮助用户收藏前询问用户是否确认")
    public R createCollect(){
        System.out.println("\n\n\n\n\n");
        return userService.createCollect();
    }

    @Tool(name = "获取商品详情",value = "获取商品详情,不需要任何信息，只需要给用户说明商品名称，商品描述，商品价格即可")
    public R<AiProductInfoDetailVo> getProductInfo(){

        return userService.getProductInfo();
    }

    @Tool(name = "取消收藏",value = "这是一个delete请求，根据商品ID取消收藏")
    public R deleteCollect(@P(value = "商品ID",required = false) String productId){
        return userService.deleteCollect();
    }


    @Tool(name = "帮助用户下单",value = "帮助用户下单,返回支付订单编号")
    public R<String> creatOrder(@P(value = "收货地址")String address,
                             @P(value = "收件人名称")String idname,
                             @P(value = "收获人电话号码") String phone){

        return userService.createOrder(address,idname,phone);
    }
}
